package com.anolesoft.amljmes.fortyone.service.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.jdbc.SQL;

import com.anolesoft.amljmes.fortyone.dto.EmpDto;
import com.anolesoft.amljmes.fortyone.dto.MesOrderTraceDto;
import com.anolesoft.amljmes.fortyone.dto.MesStoveFabinfoDto;
import com.anolesoft.amljmes.fortyone.dto.StoveDispatchQueryParamDto.StoveDispatchQueryCondition;
import com.anolesoft.amljmes.fortyone.entity.MesStoveFabinfo;
import com.anolesoft.amljmes.fortyone.entity.MesStoveQuality;
import com.anolesoft.amljmes.fortyone.entity.MesStoveQualityCustomer;
import com.anolesoft.amljmes.fortyone.vo.MesStoveFabinfoVo;
import com.anolesoft.amljmes.test.fenguangyingdu.dto.FenguangYingduEmpDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import cn.hutool.core.util.StrUtil;

@Mapper
public interface MesStoveFabinfoServiceMapper {
	@Select("select * from mes_stove_fabinfo where stoye_fabinfo_obj=#{stoveFabinfoObj, jdbcType=VARCHAR} and state=0")
	List<MesStoveFabinfoDto> MesStoveFabinfoAll(String stoveFabinfoObj);
	
	// 根据41厂制造记录条码查询
	@Select("select m.objuid," + "m.fabrecordid," + "p.ordercode," + "m.curgongxu," + " m.curgongxuname," + "t.biaoji,"
			+ "m.assignmentid," + "m.jx," + "m.partid,"
			+ "m.putnum+nvl(m.trial_num,0)+nvl(m.shiliao_num,0)+nvl(m.shibang,0)-nvl(m.pohuai_num,0)+nvl(m.ddj_num,0)+nvl(m.jieyu_num,0)-nvl(m.tk_num,0)-nvl(m.z_ddj_num,0)-nvl(m.diushi_num,0)-nvl(m.buhege_num,0)-nvl(m.refuse_num,0) putnum  "
			+ "from mes_order_trace m " + "inner join mes_process_trace t " + "on m.objuid = t.ordertraceuid "
			+ "left join pln_order_code p " + "on m.fabrecordid = p.plancode2 "
			+ " where m.fabrecordid = #{fabrecordid, jdbcType=VARCHAR} "
			+ "and t.processno = (select c.curgongxu from mes_order_trace c where c.fabrecordid = #{fabrecordid, jdbcType=VARCHAR})")
	MesOrderTraceDto MesStoveFabinfoByZzjl(String fabrecordid);

	// 删除选中（1=删除）
	@Update("    update mes_stove_fabinfo" + "      set state = 1" + "    where objuid = #{objuid, jdbcType=VARCHAR}")
	int updateMesStoveFabinfoDelete(String objuid);

	// 取消选中（0=取消删除）
	@Update("    update mes_stove_fabinfo" + "      set state = 0" + "    where objuid = #{objuid, jdbcType=VARCHAR}")
	int updateMesStoveFabinfoCancel(String objuid);

	// 修改数量
	@Update("    update mes_stove_fabinfo"
			+ "      set  inpect_state=1,inpect_date=sysdate,inpect_user= #{inpectUser, jdbcType=VARCHAR},"
			+ " yssl = #{yssl, jdbcType=INTEGER},ycjyhgs = #{ycjyhgs, jdbcType=INTEGER},"
			+ "hgps = #{hgps, jdbcType=INTEGER},rbps = #{rbps, jdbcType=INTEGER},fps = #{fps, jdbcType=INTEGER},"
			+ "checklist3 = #{checklist3, jdbcType=VARCHAR},checklist6 = #{checklist6, jdbcType=VARCHAR},"
			+ "checklist5 = #{checklist5, jdbcType=VARCHAR},checklist62 = #{checklist62, jdbcType=VARCHAR} ,"
			+ "remark= #{remark, jdbcType=VARCHAR}"
			+ "    where objuid = #{objuid, jdbcType=VARCHAR}")
	int updateMesStoveFabinfoSl(MesStoveFabinfoVo inFoDtoParam);

	// 根据炉次编号查询工序名
	@Select("select fortyone_Gxname from mes_stove_fabinfo where STOYE_FABINFO_OBJ = #{StoveFabinfoObj, jdbcType=VARCHAR} and rownum = 1")
	MesStoveFabinfoDto MesStoveFabinfoByGxname(String StoveFabinfoObj);

	// 查胸卡号密码
	@Select("select eid,password from VIEW_FENGUANGYINGDU_EMP where objuid = #{objuid, jdbcType=VARCHAR}")
	FenguangYingduEmpDTO queryEmpPassword(String objuid);

	// 查password2
	@Select("select password2 from VIEW_FENGUANGYINGDU_EMP where objuid = #{objuid, jdbcType=VARCHAR}")
	FenguangYingduEmpDTO queryEmpPassword2(String objuid);

	// 根据工序名包含入厂查询质量信息
	@Select("select q.pmd,q.zxd,q.ccd from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%入厂%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByRc();

	// 根据工序名包含清洗查询质量信息
	@Select("select q.qxjmc,q.sbbh,q.qxwd from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%清洗%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByQx();

	// 根据工序名包含干燥查询质量信息
	@Select("select q.gzfs,q.sbbh,q.gzwd,q.gzsj from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%干燥%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByGz();

	// 根据工序名包含脆性查询质量信息
	@Select("select q.cxdj from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%脆性%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByCx();

	// 根据工序名包含硬度检查查询质量信息
	@Select("select q.ydzHrc,q.ydzHra,q.ydzHr15n,q.ydzHb,q.ydzHv from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%硬度检查%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByYdjc();

	// 根据工序名包含校正查询质量信息
	@Select("select q.jzqpmd,q.jzqzxd,q.jzhpmd,q.jzhzxd from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%校正%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByJz();

	// 根据工序名为检验查询质量信息
	@Select("select q.jxxnlhsybgbh,q.jxjclhsybgbh,q.pmd,q.zxd,q.bmys from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname='检验'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByJy();

	// 根据工序名包含碳不包含氮查询质量信息
	@Select("select q.sbbh,q.dydstwd,q.dydstsj,q.dydstts,q.dedstwd,q.dedstsj,q.dedstts,q.dygsyqcsj,q.dygsyschd,q.degsyqcsj,q.degsyschd,q.dsgsyqcsj,q.dsgsyschd,q.llts,q.clwd from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%碳%' and f.fortyone_Gxname not like'%氮%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByTd();

	// 根据工序名包含氮查询质量信息
	@Select("select q.bmhhwd,q.bmhhsj,q.yyhwd,q.yyhsj,q.dydstjrwd,q.dydstbwsj,q.dydstafjl,q.dedstjrwd,q.dedstbwsj,q.dedstafjl,q.dsdstjrwd,q.dsdstbwsj,q.dsdstafjl,q.dygsyqcsj,q.dygsyschd,q.degsyqcsj,q.degsyschd,q.dsgsyqcsj,q.dsgsyschd,q.qljzmc,q.clwd from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ and f.fortyone_Gxname like'%氮%'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByD();

	// 根据工序名包含火或为预热或固溶或冷处理或氧化处理或奥式体化或时效或沉淀硬化查询质量信息
	@Select("select q.zkgzyl,q.sbbh,q.dydjrwd,q.dydjrbwsj,q.sbbhdedjrbw,q.dedjrwd,q.dedjrbwsj,q.sbbhdsdjrbw,q.dsdjrwd,q.dsdjrbwsj,q.sbbhdsidjrbw,q.dsidjrwd,q.dsidjrbwsj,q.lqfs,q.shuiwen,q.youwen,q.lpqtmc,q.tqyq,q.clwd,q.zysj from mes_stove_fabinfo f,mes_stove_quality q where f.objuid=q.STOYE_FABINFO_OBJ "
			+ "and f.fortyone_Gxname like'%火%' or f.fortyone_Gxname='预热' or f.fortyone_Gxname='固溶' or f.fortyone_Gxname='冷处理' or f.fortyone_Gxname='氧化处理' or f.fortyone_Gxname='奥式体化' or f.fortyone_Gxname='时效' or f.fortyone_Gxname='沉淀硬化'")
	List<MesStoveFabinfoDto> MesStoveFabinfoByHor();

	// 保存制造记录
	@Insert("    insert into mes_stove_fabinfo"
			+ "      (objuid, fortyone_code, order_code, fortyone_gxid, fortyone_gxname, state, paigonghao, jixing, tuhao,yssl)"
			+ "    values" + "      (sys_guid(), #{fortyoneCode, jdbcType=VARCHAR}, "
			+ "#{orderCode, jdbcType=VARCHAR}, #{fortyoneGxid, jdbcType=VARCHAR}, "
			+ "#{fortyoneGxname, jdbcType=VARCHAR},#{state, jdbcType=NUMERIC}, #{paigonghao, jdbcType=VARCHAR}, #{jixing, jdbcType=VARCHAR}, "
			+ "#{tuhao, jdbcType=VARCHAR},#{yssl, jdbcType=NUMERIC})")
	int addMesStoveFabinfo(MesStoveFabinfoDto inFoDtoParam);

	@Select(" select machinescode from bas_rcl_machines a where a.machinescode = #{machinescode, jdbcType=VARCHAR} ")
	String querySbbh(@Param("machinescode") String machinescode);

	// 保存炉次编号
	@Insert("insert into mes_stove_fabinfo "
			+ "(objuid,fortyone_code,order_code, fortyone_gxid, fortyone_gxname, biaoji,state,"
			+ " paigonghao, jixing, tuhao,yssl,stoye_fabinfo_obj,cjr, factory_id)" + "values"
			+ "(sys_guid(),#{fortyoneCode, jdbcType=VARCHAR}, "
			+ "#{orderCode, jdbcType=VARCHAR}, #{fortyoneGxid, jdbcType=VARCHAR}, "
			+ "#{fortyoneGxname, jdbcType=VARCHAR},#{biaoji, jdbcType=VARCHAR},#{state, jdbcType=NUMERIC}, "
			+ "#{paigonghao, jdbcType=VARCHAR}, #{jixing, jdbcType=VARCHAR}, "
			+ "#{tuhao, jdbcType=VARCHAR},#{yssl, jdbcType=NUMERIC},#{stoveFabinfoObj, jdbcType=VARCHAR},"
			+ "#{cjr, jdbcType=VARCHAR},#{factoryId, jdbcType=VARCHAR})")
	int insertMesStoveFabinfo(MesStoveFabinfoDto amStoveFabinfoDto);

	@Select("select count(1) from mes_stove_fabinfo where  " + "fortyone_code = #{fortyoneCode, jdbcType=VARCHAR}  "
			+ "and fortyone_gxid = #{fortyoneGxid, jdbcType=VARCHAR}   "
			+ "and fortyone_gxname = #{fortyoneGxname, jdbcType=VARCHAR}   "
			+ "and stoye_fabinfo_obj = #{stoveFabinfoObj, jdbcType=VARCHAR}")
	int selectBctm(MesStoveFabinfoDto amStoveFabinfoDto);

	// 41厂工序名是否包含工序名关键字符
	@Select(" select count(*) from Mes_order_trace a" + " where exists (select 2 "
			+ " from mes_gjgyxx_fksz g,mes_stove_base t " + " where g.gyffjc=t.gyffjc and g.factory_id=t.factory_id "
			+ " and a.curgongxuname like '%'||gxmgjzf||'%' " + " and t.objuid = #{objuid, jdbcType=VARCHAR}) "
			+ " and a.curgongxuname is not null" + " and a.fabrecordid = #{fabrecordid, jdbcType=VARCHAR} ")
	int liketMesStoveFabinfo(@Param("objuid") String objuid, @Param("fabrecordid") String fabrecordid);

	// 根据炉次编号查询所在炉次内的制造记录有哪些
	@Select("select objuid,fortyone_Code fabrecordid,order_Code ordercode,fortyone_Gxid curgongxu,fortyone_Gxname curgongxuname,"
			+ "biaoji,state,paigonghao assignmentid,jixing jx,tuhao partid,yssl putnum" + " from mes_stove_fabinfo "
			+ "where STOYE_FABINFO_OBJ = #{StoveFabinfoObj, jdbcType=VARCHAR}")
	List<MesOrderTraceDto> mesStoveFabinfoZzjl(String stoveFabinfoObj);

	// 根据炉次编号查询所在炉次内的标记有哪些
	@Select("select objuid,biaoji,fortyone_Gxname from mes_stove_fabinfo  where STOYE_FABINFO_OBJ = #{StoveFabinfoObj, jdbcType=VARCHAR}")
	List<MesStoveFabinfoDto> mesStoveFabinfobiaoji(String stoveFabinfoObj);

	// 获取41厂制造记录、当前工序名、当前工序号
	@Select("select fortyone_code,fortyone_gxid,fortyone_gxname from mes_stove_fabinfo where stoye_fabinfo_obj=#{stovefabinfoobj, jdbcType=VARCHAR} and state=0")
	List<MesStoveFabinfoDto> MesStoveFabinfoBy41(String StoveFabinfoObj);

	// 修改操作反馈信息
	@Update("update mes_process_trace b" + " set b.workcode = #{workcode}," + "b.worker = #{worker},"
			+ "b.worktime =sysdate," + "b.actstarttime =sysdate "
			+ "where b.ordertraceuid= (select objuid from mes_order_trace where fabrecordid = #{fortyoneCode, jdbcType=VARCHAR})"
			+ "  and b.processid = #{fortyoneGxid, jdbcType=VARCHAR}")
	int updateFabinfo(@Param("fortyoneCode") String fortyoneCode, @Param("workcode") String workcode,
			@Param("worker") String worker, @Param("fortyoneGxid") String fortyoneGxid);

	// 修改检验反馈信息
	@Update("update mes_process_trace b  " + "set b.lastchecker = #{lastchecker, jdbcType=VARCHAR},"
			+ "b.lcheckertime = sysdate," + "b.actendtime =sysdate," + "b.processstate=70,"
			+ "b.checknum=#{checknum, jdbcType=NUMERIC}," + "b.goodnum=#{goodnum, jdbcType=NUMERIC},"
			+ "b.rangbunum=#{rangbunum, jdbcType=NUMERIC}," + "b.rejectnum=#{rejectnum, jdbcType=NUMERIC},"
			+ "b.onesoknum=#{onesoknum, jdbcType=NUMERIC}," + "b.notes=#{notes, jdbcType=VARCHAR}  "
			+ "where b.objuid=#{objuid, jdbcType=VARCHAR}")
	int updateFabinfoJy(@Param("lastchecker") String lastchecker, @Param("checknum") int checknum,
			@Param("goodnum") int goodnum, @Param("rangbunum") int rangbunum, @Param("rejectnum") int rejectnum,
			@Param("onesoknum") int onesoknum, @Param("notes") String notes, @Param("fabrecordid") String fabrecordid,
			@Param("objuid") String objuid);

	// 添加检表信息
	@Insert(" insert into mes_process_inspect"
			+ "  (objuid,processuid,inspect_lx,inspect_bm,creat_user,creat_time,ordertraceuid,modify_user,modify_date,state)"
			+ "values" + "  (sys_guid(),"
			+ " #{mesProcessUid}  ,#{jblx},#{bm},#{cUserUid},sysdate,"
			+ "   (select objuid from mes_order_trace where fabrecordid = #{fortyoneCode}),null,null,0)")
	int insertJianbiao(@Param("jblx") String jblx, @Param("bm") String bm, @Param("mesProcessUid") String mesProcessUid,
			@Param("fortyoneCode") String fortyoneCode, @Param("cUserUid") String cUserUid);

	// 修改操作颜色
	@Update("update mes_process_scrren d  " + "set d.kaishi=4," + "d.zanting=2," + "d.jixu=2," + "d.wancheng=4,"
			+ "d.zhongjian=1  " + "where d.process_uid in (select mes_process_uid "
					+ "from mes_stove_fabinfo where stoye_fabinfo_obj = #{mesStoveBaseUid})")
	int updateCzys(@Param("mesStoveBaseUid") String mesStoveBaseUid);

	// 修改检验颜色
	@Update("update mes_process_scrren e" + " set e.gongduanzhang=2,e.jianyanyuan=2,e.zhongjian=2 "
			+ "where e.process_uid=  #{mesProcessUid, jdbcType=VARCHAR}")
	int updateJyys(@Param("mesProcessUid") String mesProcessUid);

	@Insert("insert into mes_stove_fabinfo\r\n"
			+ "  (objuid, fortyone_code, order_code, fortyone_gxid, fortyone_gxname, state, paigonghao, jixing, tuhao, yssl, ycjyhgs, hgps, rbps, fps, checklist3, checklist5, checklist6, checklist62, cjr, cjsj, factory_id, remark, stoye_fabinfo_obj, bas_rcl_machines_uid, biaoji, mes_process_uid)\r\n"
			+ "values\r\n"
			+ "  (#{objuid}, #{fortyoneCode}, #{orderCode}, #{fortyoneGxid}, #{fortyoneGxname}, #{state}, #{paigonghao}, #{jixing}, #{tuhao}, #{yssl}, #{ycjyhgs}, #{hgps}, #{rbps}, #{fps}, #{checklist3}, #{checklist5}, #{checklist6}, #{checklist62}, #{cjr}, #{cjsj}, #{factoryId}, #{remark}, #{stoyeFabinfoObj}, #{basRclMachinesUid}, #{biaoji}, #{mesProcessUid})")
	void insert(MesStoveFabinfo mesStoveFabinfo);

	@SelectProvider(type = SQLBuilder.class, method = "queryMesStoveFabinfoVOsByConditionSQL")
	List<MesStoveFabinfoVo> queryMesStoveFabinfoVOsByCondition(
			@Param("condition") StoveDispatchQueryCondition condition, Page<MesStoveFabinfoVo> page);

	class SQLBuilder {
		public String queryMesStoveFabinfoVOsByConditionSQL(@Param("condition") StoveDispatchQueryCondition condition) {
			return new SQL() {
				{
					SELECT("*");
					FROM("mes_stove_fabinfo");
					WHERE("stoye_fabinfo_obj = #{condition.curStoveUid}");
					WHERE("factory_id = #{condition.factoryId}");
					if (!StrUtil.isEmptyOrUndefined(condition.getKeyWord())) {
						WHERE("instr(upper(fortyone_code||order_code||fortyone_gxid||fortyone_gxname||biaoji||paigonghao||jixing||tuhao), upper(trim(#{condition.keyWord}))) > 0");
					}
				}
			}.toString();
		}
	}

	@Delete("delete mes_stove_fabinfo where objuid = #{objuid}")
	void deleteByObjuid(@Param("objuid") String objuid);

	@Delete("delete mes_stove_fabinfo where stoye_fabinfo_obj = #{mesStoveBaseUid}")
	void deleteByMesStoveBaseUid(@Param("mesStoveBaseUid") String mesStoveBaseUid);
	
	@Update("update mes_process_trace\r\n" + 
			"   set workcode    = #{userUid},\r\n" + 
			"       worker      = (select t.name from stf_employee  t where t.objuid=#{userUid}),\r\n" + 
			"       worktime    = sysdate,\r\n" + 
			"       processstate    = 40,\r\n" + 
			"       modify_user = #{userUid},\r\n" + 
			"       modify_date = sysdate\r\n" + 
			" where objuid in (select mes_process_uid\r\n" + 
			"                    from mes_stove_fabinfo\r\n" + 
			"                   where stoye_fabinfo_obj = #{mesStoveBaseUid})")
	void updateProcessWorkerInfo(@Param("userCode") String userCode, @Param("userUid") String userUid, @Param("mesStoveBaseUid") String mesStoveBaseUid);
	
	@Select("select * from mes_stove_quality where stoye_fabinfo_obj = #{mesStoveBaseUid}")
	MesStoveQuality queryMesStoveFabinfoServiceMapperByMesStoveBaseUid(@Param("mesStoveBaseUid") String mesStoveBaseUid);
	
	@Select("select * from mes_stove_quality_customer where mes_stove_base_uid = #{mesStoveBaseUid}")
	List<MesStoveQualityCustomer> queryMesStoveQualityCustomersByMesStoveBaseUid(@Param("mesStoveBaseUid") String mesStoveBaseUid);

	@Delete("delete mes_stove_quality where stoye_fabinfo_obj = #{mesStoveBaseUid}")
	void deleteQualityByMesStoveBaseUid(@Param("mesStoveBaseUid") String mesStoveBaseUid);
	
	@Insert("insert into mes_stove_quality\r\n" + 
			"  (objuid, cqwd,chjssj, stoye_fabinfo_obj, cjr, cjsj, factory_id, pmd, zxd, ccd, qxjmc, sbbh, qxwd, gzfs, gzwd, gzsj, cxdj, ydz_hrc, ydz_hra, ydz_hr15n, ydz_hb, ydz_hv, jzqpmd, jzqzxd, jzhpmd, jzhzxd, jxxnlhsybgbh, jxjclhsybgbh, bmys, dydstwd, dydstsj, dydstts, dedstwd, dedstsj, dedstts, dygsyqcsj, dygsyschd, degsyqcsj, degsyschd, dsgsyqcsj, dsgsyschd, llts, clwd, bmhhwd, bmhhsj, yyhwd, yyhsj, dydstjrwd, dydstbwsj, dydstafjl, dedstjrwd, dedstbwsj, dedstafjl, dsdstjrwd, dsdstbwsj, dsdstafjl, qljzmc, zkgzyl, dydjrwd, dydjrbwsj, dedjrwd, dedjrbwsj, dsdjrwd, dsdjrbwsj, dsidjrwd, dsidjrbwsj, lqfs, shuiwen, youwen, lpqtmc, tqyq, zysj, sbbhdedjrbw, sbbhdsdjrbw, sbbhdsidjrbw, fortyone_code, remark)\r\n" +
			"values\r\n" + 
			"  (#{objuid}, #{cqwd},#{chjssj},#{stoyeFabinfoObj}, #{cjr}, #{cjsj}, #{factoryId}, #{pmd}, #{zxd}, #{ccd}, #{qxjmc}, #{sbbh}, #{qxwd}, #{gzfs}, #{gzwd}, #{gzsj}, #{cxdj}, #{ydzHrc}, #{ydzHra}, #{ydzHr15n}, #{ydzHb}, #{ydzHv}, #{jzqpmd}, #{jzqzxd}, #{jzhpmd}, #{jzhzxd}, #{jxxnlhsybgbh}, #{jxjclhsybgbh}, #{bmys}, #{dydstwd}, #{dydstsj}, #{dydstts}, #{dedstwd}, #{dedstsj}, #{dedstts}, #{dygsyqcsj}, #{dygsyschd}, #{degsyqcsj}, #{degsyschd}, #{dsgsyqcsj}, #{dsgsyschd}, #{llts}, #{clwd}, #{bmhhwd}, #{bmhhsj}, #{yyhwd}, #{yyhsj}, #{dydstjrwd}, #{dydstbwsj}, #{dydstafjl}, #{dedstjrwd}, #{dedstbwsj}, #{dedstafjl}, #{dsdstjrwd}, #{dsdstbwsj}, #{dsdstafjl}, #{qljzmc}, #{zkgzyl}, #{dydjrwd}, #{dydjrbwsj}, #{dedjrwd}, #{dedjrbwsj}, #{dsdjrwd}, #{dsdjrbwsj}, #{dsidjrwd}, #{dsidjrbwsj}, #{lqfs}, #{shuiwen}, #{youwen}, #{lpqtmc}, #{tqyq}, #{zysj}, #{sbbhdedjrbw}, #{sbbhdsdjrbw}, #{sbbhdsidjrbw}, #{fortyoneCode}, #{remark})")
	void insertQuality(MesStoveQuality quality);

	@Delete("delete mes_stove_quality_customer where mes_stove_base_uid = #{mesStoveBaseUid}")
	void deleteQualityCustomersByMesStoveBaseUid(@Param("mesStoveBaseUid") String mesStoveBaseUid);

	@Insert("insert into mes_stove_quality_customer\r\n" + 
			"  (objuid, mes_stove_base_uid, mes_stove_quality_uid, seq_num, property_name, property_name_zn, property_value, factory_id)\r\n" + 
			"values\r\n" + 
			"  (#{objuid}, #{mesStoveBaseUid}, #{mesStoveQualityUid}, #{seqNum}, #{propertyName}, #{propertyNameZn}, #{propertyValue}, #{factoryId})")
	void insertMesStoveQualityCustomer(MesStoveQualityCustomer mesStoveQualityCustomer);
	
	@Select("select upper(t.biaoji) from mes_stove_fabinfo t where t.stoye_fabinfo_obj = #{mesStoveBaseUid} and t.biaoji is not null group by  upper(t.biaoji)")
	List<String> queryBiaoJisByMesStoveBaseUid(String mesStoveBaseUid);

	@Select("select t.objuid, t.eid as emp_id, t.name as emp_name, t.password\r\n" + 
			"  from stf_employee t\r\n" + 
			" where t.eid = #{empId} and t.delete_flag=0 ")
	EmpDto queryEmpByEmpId(String empId);
	
	@Select("select t.* from stf_employee t\r\n" + 
			" where t.objuid = #{objuid} and t.delete_flag = 0 ")
	EmpDto queryEmpByEmpUid(String objuid);
}
